Session State Storage Type on IIS

Description

The Session State Storage Type defines where session files are stored.

Discussion

Temporary files created as part of a user's interaction with your application are stored in Session State Storage. You can configure where session files are stored in the IIS publishing profile.

The Session State Storage Type can be configured when you are setting up your IIS publishing profile (click the Storage Settings button)

images/iissessionstate1.jpg

Or in an existing profile using the Session State Storage Type property.

images/iissessionstate2.gif

There are two options available for the Session State Storage Type:

In Session Provider

This option is the default and is currently how applications work. Files stored to session are written to the session state provider. Writing files to the session state provider can be a bottleneck causing performance issues.

Storage Connection String

This option defines a specific location where session files can be written. This offloads the session state provider, improving performance while still connecting the file to the user's session. Storage connection strings can point to Disk, Amazon S3, or Azure. In most cases for an application published to a self-hosted IIS server, a "Disk" type storage connection string makes the most sense.

Storing files on Disk

If the session files are stored on disk -- by choosing a Storage Connection String with the type Disk -- you can additionally specify how long the files will be stored and whether or not session state information can be shared among multiple applications.

images/iissessionstate3.gif

Storage Lifetime

Storage Lifetime defines how long a file will be available in the location on disk. It will be automatically deleted after the time period has elapsed. The files will be cleaned up by a new Windows service that is installed with Application Server for IIS. The service is named "Alpha Anywhere Disk Storage Monitor"

images/iissessionstate4.jpg

This service is installed as Manual startup and not running by default. It will be changed to Automatic startup and set to running when an application is published that has a "Disk" type session storage connection string. If an application is manually deployed rather that using publish, the service will need to be started and set to Automatic startup by hand.

Storage Scope

This option defines whether or not session state is shared between applications. By default session state is not shared between applications. The available storage scopes include:

Only this application

This is the default. A unique path will be appended to the storage connection string container (the disk path) to ensure files are separate for each application. For instance, a storage connection string can point to the folder "c:\temp\SessionStorage" for 2 different applications. The actual path used for each application will different though "c:\temp\SessionStorage\app1uniqueName" and "c:\temp\SessionStorage\app2uniqueName".

Shared with other applications

Occasionally, it may be necessary for applications to share session state. In these cases, both applications will need to use the same session storage. This option will use the session storage connection string as is. Each application will need to take care that the same file name is not used for files that have different content so that one won't possibly overwrite the other if they are written to session storage.

Limitations

Application Server for IIS